﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using VitCode.Castle.Entities;

namespace AMS.Core.Entities
{
    public class AssetNature : BaseEntity
    {
        protected string m_Name;
        /// <summary>
        /// 名称
        /// </summary>
        public virtual string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }

        protected string m_Code;
        /// <summary>
        /// 编码
        /// </summary>
        public virtual string Code
        {
            get { return m_Code; }
            set { m_Code = value; }
        }

        protected string m_Alias;

        /// <summary>
        /// 别名
        /// </summary>
        public virtual string Alias
        {
            get { return m_Alias; }
            set { m_Alias = value; }
        }

        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as AssetNature;
            return sObj != null && (sObj.Id == m_Id || ((sObj.Name == m_Name) && (sObj.Code == m_Code)));
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 122;
            hash = 12 * hash * m_Id.GetHashCode();
            return hash;
        }

        /// <summary>
        /// 重写ToString方法
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return m_Name;
        }

        public ArrayList GetRelateObjectInfo()
        {
            ArrayList al = new ArrayList();
            al.Add(new string[] { typeof(AssetInfo).Name, "o.Nature.Id='" + m_Id + "'", m_Name });
            return al;
        }
    }
}
